<template>
    <div class="container" :style="'height: '+docheight+'px'">
      <leftcont></leftcont>
      <div class="righCont">
        <topcont></topcont>
        <div class="content">
          <div class="setCont">
            <div class="stepCont formNoHeight">
                <el-form ref="setDetail" label-width="80px">
                  <div class="typeListCont">
                      <div class="typeList">
                        <div class="typeName">认证及会员</div>
                        <el-form-item label="认证金额">
                          <el-input
                              placeholder="请设置认证金额"
                              v-model="auth_money">
                              <template slot="append">元</template>
                          </el-input>
                        </el-form-item>
                        <el-form-item label="会员原价">
                          <el-input
                              placeholder="请设置充值金额"
                              v-model="member_original_price">
                              <template slot="append">元</template>
                          </el-input>
                        </el-form-item>
                        <el-form-item label="限时现价">
                          <el-input
                              placeholder="请设置充值金额"
                              v-model="member_current_price">
                              <template slot="append">元</template>
                          </el-input>
                        </el-form-item>
                        <el-form-item label="开启限时">
                          <el-switch
                          style="margin-top:10px"
                            v-model="yearStart"
                            active-color="#13ce66"
                            inactive-color="#ef87a8">
                          </el-switch>
                        </el-form-item>
                        <el-form-item label=" ">
                          <btn @click="saveVipFn" value="保存信息"></btn>
                        </el-form-item>
                      </div>
                      <div class="typeList">
                        <div class="typeName">套餐费用</div>
                        <el-form-item :label="item.blind_date_package_num+'次联系'" :key="index" v-for="(item,index) in packArr">
                          <el-input
                              placeholder="请设置套餐金额"
                              disabled
                              v-model="item.blind_date_package_price">
                              <template slot="append">元</template>
                          </el-input>
                        </el-form-item>
                        <el-form-item label=" ">
                          <btn disabled="" value="保存信息"></btn>
                        </el-form-item>
                      </div>
                    </div>
                </el-form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </template>
  
  <script>
    import leftcont from '@/components/leftCont.vue'
    import topcont from '@/components/topCont.vue'
    import btn from '@/components/public/btn.vue'
    import defUpImg from '@/components/public/defUpImg.vue'
    import edit from '@/components/public/edit.vue'
    import bus from '@/assets/evnetBus'
    import { payEdit,show,Blinddate } from '@/http/api'

    export default {
      components: {edit,leftcont,topcont,btn,defUpImg},
      data() {
        return {
          showData:false,
          member_current_price:'',
          member_original_price:'',
          auth_money:'',
          yearStart:false,
        }
      },
      props: {},
      methods:{
        saveInfo(){},
        saveVipFn(){
          let data = {
            auth_money:this.auth_money,
            member_original_price:this.member_original_price,
            member_current_price:this.member_current_price,
            member_limited_time:this.yearStart==true?1:2,
          }
          payEdit(data).then((res)=>{
            if(res.data.code==1){
              this.$message({
                message: '设置成功',
                type: 'success'
              });
            }else{
              this.$message(res.data.msg)
            }
            this.showData = true
          }).catch((err)=>{
            this.showData = true
            this.$message('服务器请求超时')
          });
        },
        getData(){
          show().then((res)=>{
            if(res.data.code==1){
              this.auth_money = res.data.data.auth_money
              this.member_original_price = res.data.data.member_original_price
              this.member_current_price = res.data.data.member_current_price
              this.yearStart = res.data.data.member_limited_time==1?true:false
            }else{
              this.$message(res.data.msg)
            }
            this.showData = true
          }).catch((err)=>{
            this.showData = true
            this.$message('服务器请求超时')
          });
        },
        getPack(){
          Blinddate().then((res)=>{
            if(res.data.code==1){
              this.packArr = res.data.data
            }else{
              this.$message(res.data.msg)
            }
            this.showData = true
          }).catch((err)=>{
            this.showData = true
            this.$message('服务器请求超时')
          });
        }

      },
      mounted(){
      },
      created() {
        this.getData()
        this.getPack()
      },
    }
  </script>
  
  <style scoped lang="less">
    .container{
      width: 100%;
      display: flex;
      overflow: hidden;
      .righCont{
        display: flex;
        flex-direction: column;
        flex: 1;
        margin-left: 15px;
        height: 100%;
        width: 10px;
        background-color: #F4F8FF;
        .content{
          padding: 20px;
          box-sizing: border-box;
          width: 100%;
          flex: 1;
          overflow: auto;
          .setCont{
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            background-color: #fff;
            .stepCont{
              padding: 15px;
              max-width: 800px;
              margin: 30px 0;
              .ctrlBtn{
                display: flex;
                height: 40px;
                line-height: 40px;
                justify-content: flex-end;
                .addBtn{
                  text-decoration: underline;
                  cursor: pointer;
                  color: #ffa718;
                }
              }
              .typeListCont{
                display: flex;
                flex-wrap: wrap;
                margin-bottom: 20px;
                justify-content: space-between;
                .typeList{
                  width: 48%;
                  margin-bottom: 20px;
                  background-color: #fbf1f1;
                  padding: 15px;
                  border-radius: 10px;
                  box-sizing: border-box;
                  .typeName{
                    font-size: 18px;
                    margin-bottom: 15px;
                    padding-left: 10px;
                  }
                  .el-form-item{
                    margin-bottom: 10px;
                  }
                  .delBtn{
                    color: #666;
                    text-decoration: underline;
                    cursor: pointer;
                    margin-top: 8px;
                  }
                }
              }
            }
          }
        }
      }
    }
  </style>
  